import './../sass/header.scss';
import './../sass/testinfo.scss';
import './../font/iconfont.css';

import './../js/auth.js';

const $ = require('jquery');

// 返回
$("#back").on('click',function() {
    history.back();
})

const testId = location.search.replace('?id=','');
$.ajax({
    url: '/tests/getOneTests',
    data: {
        id: testId
    },
    type: 'post',
    success({code,message,result}) {
        if (code == '1') {
            $(".testtitle").text(result.title);
            $("#testType").text(result.typeId.type);
            $("#date").text(result.date);
            $("#time").text(result.time);
        }
    }
})

function getinfo() {
    const token = localStorage.token;
    $.ajax({
        url: '/students/getUserInfo',
        data: {token},
        type: 'post',
        success(user) {
            $("#name").text(user.name)
        }
    })
}
getinfo();

$("#startTest").on('click',function() {
    location.assign(`./../html/testpaper.html?id=${testId}&status=testing`);
})